package com.mao.model.store;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.apache.struts2.json.annotations.JSON;

import com.mao.model.user.User;

@Entity
@Table(name = "MAO_STORE")
@org.hibernate.annotations.Entity(dynamicInsert = true, dynamicUpdate = true)
public class Store implements Serializable {
	
	private static final long serialVersionUID = 1L;

	public static final String STATUS_NORMAL = "0";
	public static final String STATUS_DELETED = "1";

	private Long id;
	private String companyName; // 商家名称
	private String bossName; // 店主姓名
	private String storeMobile; // 商家联系人手机
	private String storeEmail; // 商家联系邮箱
	private String address; // 地址
	private Date contractTime; // 签约时间
	private Date createTime; // 创建时间
	private Integer contractMonth; // 签约多久 月
	public String status = STATUS_NORMAL;
	private String note;
	private Set<User> users;

	@Id
	@GeneratedValue
	@Column(name = "ID")
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Column(name = "COMPANYNAME", length = 255)
	public String getCompanyName() {
		return companyName;
	}

	public void setCompanyName(String companyName) {
		this.companyName = companyName;
	}

	@Column(name = "STOREMOBILE", length = 20)
	public String getStoreMobile() {
		return storeMobile;
	}

	public void setStoreMobile(String storeMobile) {
		this.storeMobile = storeMobile;
	}

	@Column(name = "STOREEMAIL", length = 50)
	public String getStoreEmail() {
		return storeEmail;
	}

	public void setStoreEmail(String storeEmail) {
		this.storeEmail = storeEmail;
	}

	@Column(name = "CREATETIME")
	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "store")
	@JSON(serialize = false)
	public Set<User> getUsers() {
		return users;
	}

	public void setUsers(Set<User> users) {
		this.users = users;
	}

	@Column(name = "BOSSNAME")
	public String getBossName() {
		return bossName;
	}

	public void setBossName(String bossName) {
		this.bossName = bossName;
	}

	@Column(name = "ADDRESS")
	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	@Column(name = "CONTRACTTIME")
	public Date getContractTime() {
		return contractTime;
	}

	public void setContractTime(Date contractTime) {
		this.contractTime = contractTime;
	}

	@Column(name = "CONTRACTMONTH")
	public Integer getContractMonth() {
		return contractMonth;
	}

	public void setContractMonth(Integer contractMonth) {
		this.contractMonth = contractMonth;
	}

	@Column(name = "STATUS")
	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	@Column(name = "NOTE")
	public String getNote() {
		return note;
	}

	public void setNote(String note) {
		this.note = note;
	}

}
